package com.woniu.internalcommon.remote;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.internalcommon.dto.ForecastPriceDTO;
import com.woniu.internalcommon.dto.PriceRule;
import com.woniu.internalcommon.dto.ResponseResult;
import com.woniu.internalcommon.request.PriceRuleIsNewRequest;
import com.woniu.internalcommon.response.ForecastPriceResponse;
import com.woniu.internalcommon.response.PriceRulePage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "service-price",path = "service-price")
public interface ServicePriceClient {

    @RequestMapping(method = RequestMethod.POST, value = "/forecast-price")
    public ResponseResult<ForecastPriceResponse> forecast(@RequestBody ForecastPriceDTO forecastPriceDTO);


    @PostMapping("/price-rule/is-new")
    public ResponseResult<Boolean> isNew(@RequestBody PriceRuleIsNewRequest priceRuleIsNewRequest);

    @RequestMapping(method = RequestMethod.GET,value = "/price-rule/if-exists/{cityCode}/{vehicleType}")
    public ResponseResult<Boolean> ifPriceExists(@PathVariable("cityCode") String cityCode, @PathVariable("vehicleType") String vehicleType);

    @RequestMapping(method = RequestMethod.POST, value = "/calculate-price")
    public ResponseResult<Double> calculatePrice(@RequestParam("distance") Integer distance , @RequestParam("duration") Integer duration, @RequestParam("cityCode") String cityCode, @RequestParam("vehicleType") String vehicleType);

    @PostMapping("/price-rule/add")
    public ResponseResult add(@RequestBody PriceRule priceRule);

    @PostMapping("/price-rule/edit")
    public ResponseResult edit(@RequestBody PriceRule priceRule);

    @GetMapping("/price-rule/get-newest-version")
    public ResponseResult<PriceRule> getNewestVersion(@RequestParam("fareType") String fareType);

    @PostMapping("/price-rule/if-exists-old")
    public ResponseResult<Boolean> ifExists_old(@RequestBody PriceRule priceRule);


    @PostMapping("/price-rule/if-exists")
    public ResponseResult<Boolean> ifExists(@RequestParam(value = "cityCode")String cityCode,@RequestParam(value = "vehicleType")String vehicleType);

    @PostMapping("/price-rule/query")
    public ResponseResult<Page<PriceRule>> query(@RequestBody PriceRulePage priceRulePage);


    @DeleteMapping("/price-rule/delete")
    public ResponseResult delete(@RequestParam("id") Long id);

}
